<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>上传图片预览</title>
</head>
<body>
</head>  
  
<div id="img01"></div>
<div id="img02"></div>
<div id="img03"></div>
<input type="file" onchange="preview(this,{id:img01})" />  
<input type="file" onchange="preview(this,{id:img02})" />
<input type="file" onchange="preview(this,{id:img03})" /> 
<script>    
	function preview(file,obj){
		var id=obj.id.getAttribute('id')
		var prevDiv = document.getElementById(id);  
		if (file.files && file.files[0]){
		var reader = new FileReader()
		reader.onload = function(evt){  
			prevDiv.innerHTML = '<img src="' + evt.target.result + '" />';  
		}    
		reader.readAsDataURL(file.files[0]);  
	}else{  
		prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';  
		}  
	}
</script>  

</body>
</html>